package kaaengine.objects.isometric
{
	import __AS3__.vec.Vector;
	
	import kaaengine.core.ITile;
	import kaaengine.core.isometric.IsoTile;
	import kaaengine.objects.IObject;
	import kaaengine.objects.IPose;

	public class IsoObject implements IObject
	{
		private var _poses:Vector.<IPose>;
		private var _currentPose:IPose;
		private var _x:int;
		private var _y:int;
		private var _z:int;
		
		private var _xLength:int;
		private var _yLength:int;
		public var _overTiles:Vector.<Vector.<ITile>>;
		private var _name:String;
		private var _id:String;
		public var xL:int;
		public var yL:int;
		
		public function get x():int{
			return _x;
		}
		public function get y():int {
			return _y;
		}
		public function get z():int {
			return _z;
		}
		public function set x(_x:int):void {
			this._x = _x;
		}
		public function set y(_y:int):void {
			this._y = _y;
		}
		public function set z(_z:int):void {
			this._z = _z;
		}
		public function get xLength():int{
			return _xLength;
		}
		public function get yLength():int{
			return _yLength;
		}
		public function set xLength(_xLength:int):void {			
			this._xLength = _xLength;
			computeOverTiles();
		}
		public function set yLength(_yLength:int):void {
			this._yLength = _yLength;
			computeOverTiles();
			
		}
		public function get overTiles():Vector.<Vector.<ITile>> {
			return _overTiles;
		}
		private function computeOverTiles():void{
			_overTiles = new Vector.<Vector.<ITile>>(yLength+1);
			for(var i:int = 0 ; i < yLength+2 ; i++ ) {
				_overTiles[i] = new Vector.<ITile>(xLength+1);
			}
		}
		public function IsoObject()
		{
			_poses = new Vector.<IPose>();			
		}
		public function addPose(pose:IPose):void {
			_poses.push(pose);
			if( _poses.length == 1 ) _currentPose = pose;
		}
		
		public function get currentPose():IPose {
			return _currentPose;
		}
		public function get name():String {
			return _name;
		}
		public function set name(name:String):void {
			this._name = name;
		}
		public function get id():String {
			return _id;
		}
		public function set id(id:String):void {
			this._id = id;
		}
	}
}